package com.shan;

import com.shan.dao.BrandMapper;
import com.shan.pojo.Brand;
import com.shan.pojo.SqlSessionUtil;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class Add {
    public static void main(String[] args) throws IOException {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();

        BrandMapper mapper = sqlSession.getMapper(BrandMapper.class);

        String brandName = "%华为%";
        String companyName = "%华为%";
        int status = 1;

        Brand brand = new Brand();
        brand.setBrandName(brandName);
        brand.setCompanyName(companyName);
        brand.setOrdered(2);
        brand.setDescription("好牛13");
        brand.setStatus(1);

        mapper.add(brand);

        sqlSession.commit();
        System.out.println(brand.getId());

        sqlSession.close();

    }

}
